package com.fc.advbox.shiro.common;

import org.apache.shiro.session.mgt.SimpleSession;

import java.io.Serializable;

/**
 * Created by futurecreative on 2017/10/20.
 */
public class AdvSession extends SimpleSession implements Serializable{

    public enum Platform {
        web(0), ios(2), android(3), wp(4);
        final Integer value;
        Platform(Integer value) {
            this.value = value;
        }
        public Integer getValue() {
            return value;
        }
        public static Platform fromString(String platform){
            for(Platform p : Platform.values()){
                if(p.toString().equalsIgnoreCase(platform)){
                    return p;
                }
            }
            return Platform.web;
        }
    }

    private Platform platform;

    public AdvSession() {
        super();
        this.platform = Platform.web;
    }

    public AdvSession(Platform platform) {
        super();
        this.platform = platform;
    }

    public AdvSession(String host, Platform platform) {
        super(host);
        this.platform = platform;
    }

    public Platform getPlatform() {
        return platform;
    }

    public void setPlatform(Platform platform) {
        this.platform = platform;
    }
}
